package com.ys.timer;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

import com.ys.entity.business.TpAmazonShop;
import com.ys.service.business.TpAmazonShopService;

@Controller
public class TimerAmazonShop {
    
    @Autowired
    private TpAmazonShopService tpAmazonShopService;

    /**
     * 刷新店铺的首单时间
     */
	@Scheduled(cron = "0 0 9 * * * ")
	public void updateTpAmazonShopOrderDaily() {
		
		List<TpAmazonShop> listTpAmazonShop = new TpAmazonShop().where("A.FirstSaleDay is null")
				.queryList();
		
		// 连续更新14天内的数据
		for (TpAmazonShop entity : listTpAmazonShop) {
			tpAmazonShopService.updateFirstSaleDay(entity.getId());
		}
	}
	
}
